def _check_parentheses(expression: str) -> tuple[bool, int]:
    count = 0
    well = True
    dic = {"(": 1, ")": -1, "（": 1, "）": -1}
    for c in expression:
        count += dic.get(c, 0)
        if count < 0:
            well = False
    if count != 0:
        well = False
    return well, count


def _main():
    expression = input("请输入表达式：")
    well, count = _check_parentheses(expression)
    print(
        f"左右括号个数匹配{'' if well else '，但顺序不正确'}" if count == 0 else
        "左括号多于右括号" if count > 0 else
        "左括号少于右括号"  # if result < 0
    )


if __name__ == "__main__":
    _main()
